#include <algorithm>
#include <cstring>
#include <iostream>

using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f
#define MAX_SIZE 10
#define MAXN 10

int n;
int f[MAXN];

inline void init() {
    for (int i = 1; i <= n; ++i)
        f[i] = i;
}

int find(int x) {
    if (f[x] == x)
        return x;
    return f[x] = find(f[x]);
}

inline void merge(int x, int y) {
    f[find(x)] = find(y);
}
